package com.example.seleniumautotest.utils;

import com.example.seleniumautotest.SeleniumAutoTestApplication;
import org.openqa.selenium.chrome.ChromeDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class DriverService {

    @Autowired
    private Environment environment;

    // 初始化driver
    public ChromeDriver initDriver(){
        String driverType = environment.getProperty("customConfig.driverType");
        String driverPath = environment.getProperty("customConfig.driverPath");
        System.setProperty(driverType,driverPath);
        return new ChromeDriver();
    }
}
